package com.ai.bitcoin.jpa.service.impl;

import com.ai.bitcoin.jpa.dao.BccPriceDayDao;
import com.ai.bitcoin.jpa.entity.BccPriceDay;
import com.ai.bitcoin.jpa.service.BccPriceDayService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import java.util.Date;
import java.util.List;

/**
 * @author Jason
 * @date 2018/4/8
 **/
@Component
public class BccPriceDayServiceImpl implements BccPriceDayService {

    @Autowired
    BccPriceDayDao dao;

    @Override
    @Transactional
    public BccPriceDay save(BccPriceDay bccPriceDay) {
        return dao.save(bccPriceDay);
    }

    @Override
    public Page<BccPriceDay> findByBccId(String bccId, Pageable pageable) {
        return dao.findByBccId(bccId, pageable);
    }

    @Override
    public List<BccPriceDay> findByBccIdAndCreateTimeGreaterThan(String bccId, Date createTime) {
        return dao.findByBccIdAndCreateTimeGreaterThan(bccId, createTime);
    }
}
